from db.user_dao import UserDao


class UserService:
    __user_dao = UserDao()

    # 验证用户登录
    def login(self, username, password):
        return self.__user_dao.login(username, password)

    # 查询用户角色
    def search_user_role(self, username):
        return self.__user_dao.search_user_role(username)

    # 添加用户
    def add_user(self, username, password, email, role_id):
        self.__user_dao.add_user(username, password, email, role_id)

    # 查询用户总页数
    def query_total_number_users(self):
        return self.__user_dao.query_total_number_users()

    # 查询用户分页记录 列表
    def user_pagination_record(self, page):
        return self.__user_dao.user_pagination_record(page)

    # 修改用户
    def update_user(self, user_id, username, password, email, role_id):
        self.__user_dao.update_user(user_id, username, password, email, role_id)

    # 删除用户
    def delete_user(self, user_id):
        self.__user_dao.delete_user(user_id)